# List
skills = ["js", "python", "vue2", "angular", "react"]

for item in skills:
    if item == "vue2":
        print(f"current is {item} need to upgrade to vue3")
    else:
        print("Seems good")

for item in range(len(skills)):
    print(f"{item} - {skills[item]}")


nums = [1, 2, 3, 4, 5, 6]
[print(i * 5) for i in nums]
"""
输出内容为:
5
10
15
20
25
30
"""

# 使用for循环逐个添加
li = []
for i in range(1, 6):
    li.append(i)
print(li)

# 使用推导式一行添加
li2 = []
[li2.append(i) for i in range(1, 6)]
print(f"li2 now is: {li2}")  # li2 now is: [1, 2, 3, 4, 5]


# 推导式+判断
li3 = []
for i in range(1, 11):
    if i % 2 == 1:
        li3.append(i)
print(f"li3 now is: {li3}")  # li3 now is: [1, 3, 5, 7, 9]

li4 = []
[li4.append(i) for i in range(1, 10) if i % 2 == 1]
print(f"li4 now is: {li4}")  # li4 now is: [1, 3, 5, 7, 9]
